#ifndef COMPONENTREGISTRY_H
#define COMPONENTREGISTRY_H

#include "../ModelModuleSystem/ModelComponent.h"
#include <map>
#include <vector>
#include <memory>

class CGlobalComponentRegistry
{
public:
    static CGlobalComponentRegistry& GetInstance();
    
    bool RegisterComponent(const std::shared_ptr<CModelComponent>& component);
    bool UnregisterComponent(const wxString& componentName);
    std::shared_ptr<CModelComponent> GetComponent(const wxString& componentName);
    
    std::vector<std::shared_ptr<CModelComponent>> SearchComponents(
        const wxString& keyword, const wxString& category = "");
    
    std::vector<std::shared_ptr<CModelComponent>> GetComponentsByAuthor(
        const wxString& authorId);
    
    size_t GetTotalComponentCount() const;
    std::map<wxString, size_t> GetComponentStatistics() const;

private:
    CGlobalComponentRegistry() = default;
    
    std::map<wxString, std::shared_ptr<CModelComponent>> m_components;
};

#endif
